package com.example.qxfw.mongodb.qx.service.impl;

import com.example.qxfw.mongodb.qx.entity.QxImageFile;
import com.example.qxfw.mongodb.qx.service.QxImageFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

/************************************
 *
 * @author : HuangDeYin Jolly
 * @since : JDK 11
 * @Date : 2023/8/11  星期五   8:52
 * @description : 此类用来
 ***************************************/
@Slf4j
@Service
public class QxImageFileServiceImpl implements QxImageFileService {

    @Qualifier("mongoPrimaryTemplate")
    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public QxImageFile selectById(String id) {
        Criteria criteria = Criteria.where("_id").is(id);
        Query query = new Query(criteria);
        return mongoTemplate.findOne(query, QxImageFile.class);
    }
}
